﻿// Extensions Made Easy - Copyright 2012 by Jan Van der Haegen - All rights reserved, use for educational purposes only.
using System;
using System.Collections.Generic;
using Microsoft.LightSwitch;

namespace ExtensionsMadeEasy.ClientAPI.Navigation
{
    public interface IEasyNavigationModel : System.ComponentModel.INotifyPropertyChanged
    {
        /// <summary>
        /// Attempts to open the screen.
        /// </summary>
        /// <param name="screen">The name of the screen to open. (Spaces are ignored, case insensitive)</param>
        /// <returns>True if the screen was found.</returns>
        bool NavigateTo(string screen);

        /// <summary>
        /// Opens the web page in a new tab.
        /// </summary>
        /// <param name="webPage">URL to the web page</param>
        void NavigateToWebPage(string webPage);

        /// <summary>
        /// Opens the default screen for an entity.
        /// </summary>
        /// <param name="entityName">The name of the entity, for example: "Customer"</param>
        /// <param name="dataSourceName">The name of the data source, for example: "ApplicationData"</param>
        /// <param name="singleOrDefaultQueryArguments">The arguments passed to the SingleOrDefault query of the entity, most likely the ID.  For example: 1</param>
        /// <returns>True if all went well...</returns>
        bool NavigateTo(string entityName, string dataSourceName, params object[] singleOrDefaultQueryArguments);

        /// <summary>
        /// Opens the default screen for an entity.
        /// </summary>
        /// <param name="entityName">The name of the entity, for example: "Customer"</param>
        /// <param name="dataService">The data source, for example: ApplicationData</param>
        /// <param name="singleOrDefaultQueryArguments">The arguments passed to the SingleOrDefault query of the entity, most likely the ID.  For example: 1</param>
        /// <returns>True if all went well...</returns>
        bool NavigateTo(string entityName, IDataService dataService, params object[] singleOrDefaultQueryArguments);

        /// <summary>
        /// Returns true if forward screen navigation is possible
        /// </summary>
        bool CanNavigateForward { get; }

        /// <summary>
        /// Navigates forward through the opened screens
        /// </summary>
        void NavigateForward();

        /// <summary>
        /// Returns true if backwards screen navigation is possible
        /// </summary>
        bool CanNavigateBackward { get; }

        /// <summary>
        /// Navigates backwards through the opened screens
        /// </summary>
        void NavigateBackward();

        /// <summary>
        /// Returns an ordened list of the most recently opened screens
        /// </summary>
        List<string> RecentlyOpenedScreens { get; }

        /// <summary>
        /// Returns an ordened list of the most recently closed screens
        /// </summary>
        List<string> RecentlyClosedScreens { get; }

        /// <summary>
        /// Returns an ordened list of the most favorite screens
        /// </summary>
        List<string> FavoriteOpenedScreens { get; }
    }
}